home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / liboctave / FEGrid.h < prev    next >
C/C++ Source or Header  |  1996-03-03  |  2KB  |  93 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_FEGrid_h)
  24. #define octave_FEGrid_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. class ostream;
  31.  
  32. #include "dColVector.h"
  33.  
  34. class
  35. FEGrid
  36. {
  37. public:
  38.  
  39.   FEGrid (void)
  40.     : elem () { }
  41.  
  42.   FEGrid (const ColumnVector& elbnds)
  43.     : elem (elbnds) { check_grid (); }
  44.  
  45.   FEGrid (int nel, double width);
  46.  
  47.   FEGrid (int nel, double left, double right);
  48.  
  49.   FEGrid (const FEGrid& a)
  50.     : elem (a.elem) { }
  51.  
  52.   FEGrid& operator = (const FEGrid& a)
  53.     {
  54.       if (this != &a)
  55.     elem = a.elem;
  56.  
  57.       return *this;
  58.     }
  59.  
  60.   ~FEGrid (void) { }
  61.  
  62.   int element (double x) const;
  63.  
  64.   double left (void) const { return elem.elem (0); }
  65.  
  66.   double right (void) const { return elem.elem (elem.capacity () - 1); }
  67.  
  68.   int in_bounds (double x) const { return (x >= left () && x <= right ()); }
  69.  
  70.   ColumnVector element_boundaries (void) const { return elem; }
  71.  
  72.   friend ostream& operator << (ostream&, const FEGrid&);
  73.  
  74. protected:
  75.  
  76.   ColumnVector elem;
  77.  
  78. private:
  79.  
  80.   void error (const char* msg) const;
  81.   void nel_error (void) const;
  82.  
  83.   void check_grid (void) const;
  84. };
  85.  
  86. #endif
  87.  
  88. /*
  89. ;;; Local Variables: ***
  90. ;;; mode: C++ ***
  91. ;;; End: ***
  92. */
  93.